﻿using Mock1G3.BaseEntities;
using Mock1G3.BussinessLogic;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Mock1G3.UserControl.UCCheckBalance
{
    public partial class CheckBalance : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Session["AccountNo"] == null) Response.Redirect("Validate.aspx");
                else
                {
                    GetBalanceLogic account = new GetBalanceLogic();
                    DataTable dt = new DataTable();
                    Card card = new Card();
                    card.CardNo = Session["CardNo"].ToString();
                    dt = account.GetBalance(card);
                    Repeater1.DataSource = dt;
                    Repeater1.DataBind();
                    InsertLogUC3Logic log = new InsertLogUC3Logic();
                    ATM atm = new ATM();
                    atm.ATMID = Int32.Parse(Session["ATMID"].ToString());
                    log.Insert(atm, card);
                }
                //Session.RemoveAll();
            }
        }

        protected void btnCancel_Click1(object sender, EventArgs e)
        {
            Session.RemoveAll();
            Response.Redirect("Default.aspx");
        }

        protected void btnOk_Click1(object sender, EventArgs e)
        {
            Session.RemoveAll();
            Response.Redirect("Default.aspx");
        }
    }
}